<html>
<head><meta charset="utf-8"><title>Feature-gated lint in #71862 · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html">Feature-gated lint in #71862</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="198424505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198424505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198424505">(May 22 2020 at 10:03)</a>:</h4>
<p>In <a href="https://github.com/rust-lang/rust/issues/71862">#71862</a> I tried to feature-gate a lint by adding a check in <code>LintLevelsBuilder::push</code>. However, when running <code>rustc</code> with <code>-Zdeduplicate-diagnostics=no</code>, it actually emits 2 duplicate errors, and when running with <code>-Zdeduplicate-diagnostics=no</code> and <code>-Zunstable-options</code>, it emits 3 errors. Can someone help me out here?</p>



<a name="198496025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198496025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198496025">(May 22 2020 at 21:16)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> CI fails on <a href="https://github.com/rust-lang/rust/issues/71862">#71862</a> because of this. Should I just slap a FIXME to unblock the PR?</p>



<a name="198496079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198496079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198496079">(May 22 2020 at 21:17)</a>:</h4>
<p>I'm confused :)</p>



<a name="198496287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198496287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198496287">(May 22 2020 at 21:20)</a>:</h4>
<p>what does -Zunstable-options even do?</p>



<a name="198496294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198496294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198496294">(May 22 2020 at 21:20)</a>:</h4>
<p>oh, right, I remember</p>



<a name="198496333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198496333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198496333">(May 22 2020 at 21:21)</a>:</h4>
<p><span class="user-mention" data-user-id="255061">@LeSeulArtichaut</span> any idea why it's changed? I suppose it has to do with that code in the lint levels stuff runing more times somehow?</p>



<a name="198496386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198496386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198496386">(May 22 2020 at 21:21)</a>:</h4>
<p>No, I have no idea</p>



<a name="198496439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198496439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198496439">(May 22 2020 at 21:22)</a>:</h4>
<p>I'm going to re-read my code :D</p>



<a name="198496618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198496618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198496618">(May 22 2020 at 21:24)</a>:</h4>
<p>The check I added is similar to other checks in the same place</p>



<a name="198496648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198496648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198496648">(May 22 2020 at 21:25)</a>:</h4>
<p>Like the "unknown lint" check which doesn't get repeated</p>



<a name="198496676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198496676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198496676">(May 22 2020 at 21:25)</a>:</h4>
<p>Could it be because the code is in a separate function?</p>



<a name="198498548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198498548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198498548">(May 22 2020 at 21:46)</a>:</h4>
<p>I kind of have no idea</p>



<a name="198498565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198498565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198498565">(May 22 2020 at 21:47)</a>:</h4>
<p>do you see the difference when you run manually?</p>



<a name="198498574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198498574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198498574">(May 22 2020 at 21:47)</a>:</h4>
<p>i.e., with rustc on the command line?</p>



<a name="198547340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198547340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198547340">(May 23 2020 at 18:55)</a>:</h4>
<p>Running:</p>
<div class="codehilite"><pre><span></span><code>rustc +stage1 -D unsafe_op_in_unsafe_fn -Zunstable-options -Zdeduplicate-diagnostics=no anyfile.rs
</code></pre></div>


<p>Also gives me 3 errors.</p>



<a name="198548376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198548376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198548376">(May 23 2020 at 19:26)</a>:</h4>
<p>Howeber I'm a bit surprised that</p>
<div class="codehilite"><pre><span></span><code>rustc +stage1 -Zdeduplicate-diagnostics=no -Zunstable-options -W azerty file.rs
</code></pre></div>


<p>Also gives me 3 errors:</p>
<div class="codehilite"><pre><span></span><code>error[E0602]: unknown lint: `azerty`
  |
  = note: requested on the command line with `-W azerty`

error[E0602]: unknown lint: `azerty`
  |
  = note: requested on the command line with `-W azerty`

error[E0602]: unknown lint: `azerty`
  |
  = note: requested on the command line with `-W azerty`
</code></pre></div>



<a name="198548380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198548380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198548380">(May 23 2020 at 19:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> This isn't expected behaviour, right? Should I open an issue for this?</p>



<a name="198549728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198549728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198549728">(May 23 2020 at 20:03)</a>:</h4>
<p>Hmm, this seems to be the case since <a href="https://github.com/rust-lang/rust/issues/67122">#67122</a> where <code>-Zdeduplicate-diagnostics=no</code> is applied</p>



<a name="198549792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Feature-gated%20lint%20in%20%2371862/near/198549792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Feature-gated.20lint.20in.20.2371862.html#198549792">(May 23 2020 at 20:04)</a>:</h4>
<p>So I guess it is acceptable to have deduplicated errors in <a href="https://github.com/rust-lang/rust/issues/71862">#71862</a>?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>